package org.example.realtime.traffic.dwd.log.function;
import org.apache.flink.api.common.functions.ReduceFunction;
/**
 * @Title: FlowReportReduceFunction
 * @Author Lianzy
 * @Package org.example.realtime.traffic.dwd.log.function
 * @Date 2025/5/29 18:09
 * @description
 */
public class FlowReportReduceFunction implements ReduceFunction<TrafficFlow> {

    @Override
    public TrafficFlow reduce(TrafficFlow trafficFlow, TrafficFlow bean) throws Exception {
        // todo trafficFlow：表示增加计算中间结果；bean：表示窗口中每条数据
        // 增量计算
        trafficFlow.setLicensePlateCount(trafficFlow.getLicensePlateCount() + bean.getLicensePlateCount());
        // 返回结果
        return trafficFlow;
    }
}